package com.jinmdz.fmis.api.rec.controller;

import com.jinmdz.fmis.api.base.BaseController;
import com.jinmdz.fmis.api.rec.model.recinfo.RecInfoAllRequestData;
import com.jinmdz.fmis.api.rec.service.RecActualItemService;
import com.jinmdz.fmis.core.base.BaseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author GaoXiangLiang
 * @date 2020-6-19 14:02
 */
@Api(description = "车辆调度实际使用物品相关接口")
@RestController()
@RequestMapping("/rec/rec-actual-item/")
public class RecActualItemController extends BaseController {

    @Resource
    private RecActualItemService recActualItemService;

    /**
     * 加载车辆调度信息列表rec_actual_item表中
     *
     * @param
     * @return
     * @author GaoXiangLiang
     * @date 2020-6-19 14:55
     */
    @ApiOperation(value = "根据分类编码加载rec_actual_item表中服务项目信息", notes = "根据分类编码加载rec_actual_item表中服务项目信息")
    @PostMapping("load-rec-actual-item-with-rec-id")
    public BaseResult loadRecActualItemWithRecId(@RequestBody RecInfoAllRequestData data) {
        return resultHandler(data, userItem -> recActualItemService.listActualItemByTypeCodeAndRecId(data.getId()));
    }

    /**
     * 加载车辆调度信息列表dispatch_car表中
     *
     * @param
     * @return
     * @author GaoXiangLiang
     * @date 2020-6-19 14:55
     */
    @ApiOperation(value = "根据分类编码加载rec_actual_item表中服务项目信息", notes = "根据分类编码加载rec_actual_item表中服务项目信息")
    @PostMapping("load-rec-actual-item-with-rec-code")
    public BaseResult loadRecActualItemWithRecCode(@RequestBody RecInfoAllRequestData data) {
        return resultHandler(data, userItem -> recActualItemService.listRecActualItemWithRecCode(data.getRecCode()));
    }

}
